package aliai

import (
	sts20150401 "github.com/alibabacloud-go/sts-20150401/v2/client"
	"github.com/alibabacloud-go/tea/tea"
	"time"
)

type AssumeRoleStsGetResp struct {
	Result *sts20150401.AssumeRoleResponse `json:"result"`
}

func (this *AssumeRoleStsGetResp) IsSuccess() bool {
	return tea.Int32Value(this.Result.StatusCode) == 200
}

type StsToken struct {
	Body *sts20150401.AssumeRoleResponseBody `json:"body"`

	//过期时间点，早于当前时间10分钟前就算过期
	ExpireTime int64 `json:"expire_time"`
}

func (this *StsToken) IsExpired() bool {
	return this.ExpireTime < time.Now().Unix()+10*60
}
